#!/bin/bash
#  ln -s /root/.nvm/versions/node/v16.14.0/bin/node /usr/local/bin/node

while read oldrev newrev refname
do
  branch=$(git rev-parse --symbolic --abbrev-ref "$refname")
  echo "当前分支：$branch" 
  if [[ 'master' == "$branch" ]]; then
    git checkout -f "$branch"
    cd /srv/code/work/pd148-mcddv && /root/.nvm/versions/node/v16.14.0/bin/yarn install && /root/.nvm/versions/node/v16.14.0/bin/yarn build
    cp -Rf /srv/work/pd148-mcddv/dist/* /srv/web/pd148-mcddv
  fi
done
